<template>
  <div>
    <van-cell-group>
      <van-field type="text" v-model="assess.name" label="教师姓名" disabled/>
      <van-field type="text" v-model="assess.kcname" label="课程名称" disabled/>
    </van-cell-group>
    <div class="item sae-textarea">
      <van-cell-group>
        <van-field type="textarea" rows="5" autosize v-model="assess.performance" label="上课表现" :disabled="editor"/>
      </van-cell-group>
    </div>
    <div class="item sae-textarea">
      <van-cell-group>
        <van-field type="textarea" rows="5" autosize v-model="assess.task" :disabled="editor">
          <div class="sae-label" slot="label">作业 <span>*</span></div>
        </van-field>
      </van-cell-group>
    </div>
    <div class="item sae-textarea">
      <van-cell-group>
        <van-field type="textarea" rows="5" autosize v-model="assess.remind" label="特别提醒" :disabled="editor"/>
      </van-cell-group>
    </div>
  </div>
</template>

<script>
import api from '@/api'
export default {
  name: 'assess',
  data () {
    return {
      assess: {
        kcname: '', // 课程名称
        name: '',
        performance: '', // 表现
        task: '', // 作业
        remind: '' // 提醒
      }
    }
  },
  methods: {
    getAssess () {
      return this.assess
    }
  },
  props: ['editor'],
  created () {
    let id = this.$route.query.id
    let name = this.$route.query.name
    let kcname = this.$route.query.kcname
    this.assess.kcname = kcname
    if (name) {
      this.assess.name = name
      // this.assess.name = JSON.parse(sessionStorage.getItem('user')).name
    }
    api.studentAssess({
      params: {arrangement_id: id},
      callback: res => {
        if (res.data.data) {
          Object.keys(this.assess).forEach(item => {
            this.assess[item] = res.data.data[item]
          })
        }
      }
    })
  }
}
</script>

<style scoped>
  .item{
    border-top: 10px solid #F2F2F2;
  }
</style>
